package com.woniuxy.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * @author fengyao
 * @version 1.0
 * @date 2019/9/28 0028 上午 2:32
 */
public class TimeUtils {

    static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static String getStartTime(){
        Date date = new Date();
        date.setDate(date.getDate()+1);
        date.setHours(8);
        date.setMinutes(0);
        date.setSeconds(0);
        String start = simpleDateFormat.format(date);
        return start;
    }

    public static String getStopTime(){
        Date date = new Date();
        date.setDate(date.getDate()+2);
        date.setHours(8);
        date.setMinutes(0);
        date.setSeconds(0);
        String stop = simpleDateFormat.format(date);
        return stop;
    }

    public static String getCreated(){
        Date date = new Date();
        String created = simpleDateFormat.format(date);
        return created;
    }

    public static String getUUID(){
        return UUID.randomUUID().toString().replaceAll("-","");
    }

    public static Long getTimeDiff(String big,String small) throws ParseException {
        Date bigger = simpleDateFormat.parse(big);
        Date smaller = simpleDateFormat.parse(small);
        return bigger.getTime()-smaller.getTime();
    }
}
